<? 
require "include/bittorrent.php";
dbconn();
loggedinorreturn();

$res = query("SELECT id, name FROM categories ORDER BY name");
while($cat = mysql_fetch_assoc($res))
$catoptions .= "<input type=\"checkbox\" name=\"cat[]\" value=\"$cat[id]\" ".(strpos($CURUSER['notifs'], "[cat$cat[id]]") !== false ? " checked" : "") . "/>$cat[name]<br>";
$category[$cat['id']] = $cat['name'];

stdhead("RSS Feeds");

if ($_SERVER['REQUEST_METHOD'] == "POST") {
$link = "$SITEURL/rss.php";
if ($_POST['feed'] == "dl")
$query[] = "feed=dl";
if (isset($_POST['cat']))
$query[] = "cat=".implode(',', $_POST['cat']);
if ($query)
$queries = implode("&", $query);
if ($queries)
$link .= "?$queries&passkey=$CURUSER[passkey]";
else
$link .= "?passkey=$CURUSER[passkey]";

print("<br> Use the following url in your RSS reader: <br><br><b>$link</b><br>");
stdfoot();
die();
}
?>

<FORM method="POST" action="getrss.php">
<table border="1" cellspacing="1" cellpadding="5">
<TR>
<TD class="rowhead">Categories to retrieve:
</TD>
<TD><?=$catoptions?>
</TD>
</TR>
<TR>
<TD class="rowhead">Feed type:
</TD>
<TD>
<input type="checkbox" name="feed" value="dl" />Download Link
</TD>
</TR>
<TR>
<TD colspan="2" align="center">
<BUTTON type="submit">Generate RSS link</BUTTON>
</TD>
</TR>
</TABLE>
</FORM>

<?
stdfoot();
?>